package org.example.hw.util.mapping;

import org.example.hw.dto.link.AddLinkDto;
import org.example.hw.dto.link.EditLinkDto;
import org.example.hw.model.Link;
import org.example.hw.model.User;

public class LinkMapping {

	public static Link mapAdd(AddLinkDto addLinkDto, User createdBy) {
		Link link = new Link();

		link.setOriginalUrl(addLinkDto.getOriginalUrl());
		link.setCustomUrl(addLinkDto.getCustomUrl());
		link.setVisibility(addLinkDto.getVisibility());
		// TODO mapiranje za email adrese
		link.setCreatedBy(createdBy);
		link.setModifiedBy(createdBy);

		return link;
	}

	public static Link mapEdit(EditLinkDto editLinkDto, User modifiedBy) {
		Link link = new Link();

		link.setOriginalUrl(editLinkDto.getOriginalUrl());
		link.setCustomUrl(editLinkDto.getCustomUrl());
		link.setVisibility(editLinkDto.getVisibility());
		// TODO mapiranje za email adrese
		link.setModifiedBy(modifiedBy);

		return link;
	}

}
